package com.ctshk.rpc.order.ship.service;

import com.ctshk.common.dto.Result;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.model.TokenUser;
import com.ctshk.common.vo.OrderRefundDTO;
import com.ctshk.rpc.booking.req.system.SystemConfirmReq;
import com.ctshk.rpc.order.ship.dto.*;
import com.ctshk.rpc.order.ship.req.*;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 船票订单 服务类
 * </p>
 *
 * @author 刘蕾
 * @since 2021-03-16
 */
public interface IShipOrderService {

    /**
     * 保存订单
     *
     * @param shipOrderReq
     * @param user
     * @return
     */
    Result saveShipOrder(ShipOrderReq shipOrderReq, TokenUser user);

    /**
     * 保存订单
     *
     * @param apiShipOrderReq
     * @param user
     * @return
     */
    Result saveApiShipOrder(ApiShipOrderReq apiShipOrderReq, TokenUser user);


    /**
     * 支付下单
     *
     * @param
     * @param reqList
     * @param currentUser
     * @return
     */
    Result payOrder(List<ShipOrderCollectionReq> reqList, TokenUser currentUser);

    /**
     * 查询订单列表
     *
     * @param shipOrderPageReq
     * @return
     */
    PageResponse<ShipOrderPageDTO> queyList(ShipOrderPageReq shipOrderPageReq);

    /**
     * 取消订单
     *
     * @param cancelOrderReq
     * @param currentUser
     * @return
     */
    Result cancelApprove(ShipCancelOrderReq cancelOrderReq, TokenUser currentUser);

    /**
     * 确认取消
     *
     * @param id
     * @param refundId
     * @param userId
     * @return
     */
    Result confirmRefund(Long id, Long refundId, Long userId);

    /**
     * 查询订单详情
     *
     * @param id
     * @return
     */
    Result<ShipOrderInfoDetailDTO> queryOrderDetailInfo(Long id);

    /**
     * 供應商預定確認接口
     * @param systemConfirmReq
     * @param userId
     * @return
     */
    Result supplieConfirmOrder(SystemConfirmReq systemConfirmReq, Long userId);


    /**
     * 取消操作
     * @param shipOrderCheckReq
     * @param user
     * @return
     */
    Result cancelOrder(ShipOrderCheckReq shipOrderCheckReq, TokenUser user);

    /**
     * 船票退款列表
     * @param shipOrderRefundReq
     * @return
     */
    Result<List<ShipOrderRefundListDTO>> list(ShipOrderRefundReq shipOrderRefundReq);

    /**
     * 确认预订
     * @param shipProductOrderReq
     * @param currentUser
     * @return
     */
    Result<Long> confirmOrder(ShipProductOrderReq shipProductOrderReq, TokenUser currentUser);

    /**
     * 最近一次查询结束时间到当前时间的数据
     */
    Result<List<MyShipOrderDTO>> recentToNow(LocalDateTime recent, LocalDateTime now);

    /**
     * 保险记录
     * @param insuranceReq
     * @return
     */
    Result<List<ShipOrderInsuranceDTO>> insuranceRecord(InsuranceReq insuranceReq);

    /**
     * 订单详情接口
     * @param id
     * @return
     */
    Result<ShipOrderInfoDTO> queryOrderDetail(Long id);

    /**
     * 待支付取消訂單
     * @param cancelOrderReq
     * @param user
     * @return
     */
    Result cancelOrderBeforePay(ShipCancelOrderReq cancelOrderReq, TokenUser user);

    /**
     * 獲取退款金額
     * @param shipOrderCheckReq
     * @param currentUser
     * @return
     */
    Result<BigDecimal> getOrderAmount(ShipOrderCheckReq shipOrderCheckReq, TokenUser currentUser);


    /**
     * 退款记录 (财务-内部调用)
     * @param orderId
     * @return
     */
    Result<List<OrderRefundDTO>> refundRecords(Long orderId);


    /**
     * 确认退款(财务-内部调用)
     * @param refundNumber
     * @return
     */
    Result confirmRefund(String refundNumber, Long userId);

    /**
     * 删除退款记录（审批不通过的退款记录）
     * @param refundId
     * @param userId
     * @return
     */
    Result deleteRefund(Long refundId, Long userId);

    /**
     * 通知旅客
     * @param shipOrderNoticeReq
     * @return
     */
    Result notice(ShipOrderNoticeReq shipOrderNoticeReq);

    /**
     * 超时取消订单
     * @param orderId
     * @return
     */
    Result updateOrderPaymentStatus(Long orderId);

    /**
     * 获取ATB票的信息
     * @param shipTicketReq
     * @return
     */
    Result<List<ShipOrderAtbTicketDTO>> getAtbTicket(ShipTicketReq shipTicketReq);

    /**
     * 最近一次查询结束时间到当前时间的订单DTO
     */
    List<ShipOrderDTO> queryOrderDTOList(LocalDateTime start, LocalDateTime end);
}
